﻿// --------------------------------------------------------------------------------------------------------------------- 
// <copyright file="Problem10.cs" company="Microsoft">
//   Copyright (c) Microsoft Corporation.  All rights reserved. THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
// </copyright>
// <summary>
//   Defines the Problem10 type.
// </summary>
// ---------------------------------------------------------------------------------------------------------------------
namespace EulerProblemsCSharp.Problems
{
    using System.Linq;

    /// <summary>
    /// Problem 10.
    /// </summary>
    public class Problem10 : ProblemBase
    {
        /// <summary>
        /// Gets Number.
        /// </summary>
        /// <value>
        /// The number.
        /// </value>
        public override int Number
        {
            get
            {
                return 10;
            }
        }

        /// <summary>
        /// Gets Description.
        /// </summary>
        /// <value>
        /// The description.
        /// </value>
        public override string Description
        {
            get
            {
                return "Find the sum of all the primes below two million.";
            }
        }

        /// <summary>
        /// Solves the problem
        /// </summary>
        /// <returns>
        /// The solution to the problem.
        /// </returns>
        public override object Solve()
        {
            var answer = new SieveOfEratosthenes().GetPrimes(2000000).Sum();

            // using code suggested by kfarmer.
            //// var answer = new SieveOfEratosthenes().GetPrimes2(2000000).Sum();           

            return answer;
        }
    }
}